package com.itestor.iptv.modules.ne.actions;


import java.util.List;

import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import com.itestor.iptv.global.actions.AbstractPagedQueryAction;
import com.itestor.iptv.global.bean.AbstractPagedQuery;
import com.itestor.iptv.modules.common.domain.RoleGroup;
import com.itestor.iptv.modules.common.service.UserService;
import com.itestor.iptv.modules.ne.bean.RoleSelRobotQuery;
import com.itestor.iptv.modules.ne.service.RobotManageService;

/**
 * 
 * @author Mr.li
 * 
 */
public class RoleSelRobotQueryAction extends AbstractPagedQueryAction {

    /**
     * Logger for this class.
     */
    private static final Logger logger = Logger
            .getLogger(RobotSelectQueryAction.class);

    private RobotManageService robotManageService;
    
    private UserService userService;
        
    @SuppressWarnings("unchecked")    
    public AbstractPagedQuery doPagedQuery(ActionForm form,
            HttpServletRequest request, int pagerCount, int pagerOffset)
            throws Exception {
        String queryIdRoleGroup = request.getParameter("queryIdRoleGroup");
        
        RoleSelRobotQuery roleSelRobotQuery = new RoleSelRobotQuery();        
        roleSelRobotQuery.setPagerCount(pagerCount);
        roleSelRobotQuery.setPagerOffset(pagerOffset);
        
        if (!StringUtils.isEmpty(queryIdRoleGroup)){
            roleSelRobotQuery.setQueryIdRoleGroup(Integer.parseInt(queryIdRoleGroup)); 
            request.setAttribute("queryIdRoleGroup",queryIdRoleGroup);
        }
        
        List<RoleGroup> roleGroupList= userService.findAllRoleGroup();      
        request.setAttribute("roleGroupList", roleGroupList); 
        
        robotManageService.queryRoleSelRobotList(roleSelRobotQuery);
        return roleSelRobotQuery;
    }
    
    /**
     * 　
     * @param pRobotManageService
     */
    public void setRobotManageService(RobotManageService pRobotManageService) {
        robotManageService = pRobotManageService;
    }
    /**
     * 
     * @param pUserService
     */
    public void setUserService(UserService pUserService) {
        userService = pUserService;
    }
    
    
    
    


}